<%@ Page Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="Menus.aspx.cs" Inherits="Menus" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="phMain" Runat="Server">
    <fieldset>
        <legend>Current Menus</legend>
        <asp:GridView ID="gvMenus" runat="server" AutoGenerateColumns="False" DataSourceID="dsMenus" DataKeyNames="Id,ConcurencyId" >
            <Columns>
                <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" ReadOnly="True" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:TemplateField HeaderText="Parent Post">
                    <ItemTemplate>
                        <%#Eval("ParentPath") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="selMenu" runat="server" AppendDataBoundItems="true" DataSourceID="dsPosts" DataTextField="Path" DataValueField="Id" SelectedValue='<%# Bind("ParentId") %>'>
                            <asp:ListItem Text="None" Value="0" />
                        </asp:DropDownList>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:CheckBoxField DataField="IncludeParent" HeaderText="Include Parent" SortExpression="IncludeParent" >
                    <ItemStyle HorizontalAlign="Center" />
                </asp:CheckBoxField>
                <asp:CheckBoxField DataField="DefaultForAllPosts" HeaderText="Default For Posts"
                    SortExpression="DefaultForAllPosts">
                    <ItemStyle HorizontalAlign="Center" />
                </asp:CheckBoxField>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            </Columns>
        </asp:GridView>
    </fieldset>
    <fieldset>
        <legend>Add New</legend>
        <asp:DetailsView ID="dvMenu" runat="server" AutoGenerateRows="False" DataKeyNames="Id,ConcurencyId" DataSourceID="dsMenus" DefaultMode="Insert" >
            <Fields>
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:TemplateField HeaderText="Parent Post">
                    <InsertItemTemplate>
                        <asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="True" DataSourceID="dsPosts"
                            DataTextField="Path" DataValueField="Id" SelectedValue='<%# Bind("ParentId") %>'>
                            <asp:ListItem Value="0">None</asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:CheckBoxField DataField="IncludeParent" HeaderText="Include Parent" />
                <asp:CheckBoxField DataField="DefaultForAllPosts" HeaderText="Default For Posts"
                    SortExpression="DefaultForAllPosts" />
                <asp:CommandField ShowInsertButton="True" />
            </Fields>
        </asp:DetailsView>
    </fieldset>
    <acmsdc:MenuDataSource ID="dsMenus" runat="server" OnSelectData="dsMenus_SelectData" OnUpdatingData="dsMenus_UpdatingData">
    </acmsdc:MenuDataSource>
    <acmsdc:PostDataSource ID="dsPosts" runat="server" OnSelectData="dsPosts_SelectData" />
</asp:Content>

